import math

import numpy as np


def check(l, cc):
    c = [0, 0, 0]
    if math.sqrt((cc[0] - c[0]) * (cc[0] - c[0]) + (cc[1] - c[1]) * (cc[1] - c[1]) + (cc[2] - c[2]) * (cc[2] - c[2])) < 50:
        return False
    if len(l) > 0:
        c = l[len(l) - 1]
        if math.sqrt((cc[0] - c[0]) * (cc[0] - c[0]) + (cc[1] - c[1]) * (cc[1] - c[1]) + (cc[2] - c[2]) * (cc[2] - c[2])) < 50:
            return False
    for c in l:
        if math.sqrt((cc[0] - c[0]) * (cc[0] - c[0]) + (cc[1] - c[1]) * (cc[1] - c[1]) + (cc[2] - c[2]) * (cc[2] - c[2])) < 30:
            return False
    return True


if __name__ == "__main__":
    colors = []
    for i in range(0, 255):
        while True:
            c = list(np.random.choice(range(256), size=3))
            if check(colors, c):
                colors.append(c)
                break
    colors.append([0, 0, 0])
    print(colors)

    code = 'const ScnsColorArgb8888 scnsColorRandomMap[256]={\n    '
    for i in range(0, len(colors)):
        code += '0XFF%02X%02X%02X' % (colors[i][0], colors[i][1], colors[i][2]) + ','
        if (i + 1) % 8 == 0:
            code += '\n    '
    code += '};'
    print(code)
